var Util = {
	OS : "",
	WINDOWS : "winnt",
	LINUX : "linux",
	MAC : "darwin",
	PATH_SEP : "/",
	init : function() {
		try {
			// 当前系统
			var osString = Components.classes["@mozilla.org/xre/app-info;1"]
					.getService(Components.interfaces.nsIXULRuntime).OS;
			switch (osString.toLowerCase()) {
			case Util.WINDOWS:
				Util.OS = Util.WINDOWS; // Windows Vista, XP, 2000, and NT
										// systems;
				Util.PATH_SEP = "\\";
				break;
			case Util.LINUX:
				Util.OS = Util.LINUX; // GNU/Linux;
				Util.PATH_SEP = "/";
				break;
			case Util.MAC:
				Util.OS = Util.MAC; // MAC OSX/Darwin
				Util.PATH_SEP = "/";
				break;
			default:
				Util.OS = Util.WINDOWS;
				Util.PATH_SEP = "\\";
			}
		} catch (e) {
			Util.OS = Util.WINDOWS;
		}
	},

	// Flash Player的安全（信任）目录路径finspector.cfg
	getFinspectorTrustPath : function() {
		switch (Util.OS) {
		case Util.WINDOWS:
			var fl = Components.classes["@mozilla.org/file/directory_service;1"]
					.getService(Components.interfaces.nsIProperties).get(
							"AppData", Components.interfaces.nsIFile);
			var fp = fl.path
					+ "\\Macromedia\\Flash Player\\#Security\\FlashPlayerTrust\\finspector.cfg";
			break;
		case Util.LINUX:
			var fl = Components.classes["@mozilla.org/file/directory_service;1"]
					.getService(Components.interfaces.nsIProperties).get(
							"Home", Components.interfaces.nsIFile);
			var fp = fl.path
					+ "/.macromedia/Flash_Player/#Security/FlashPlayerTrust/finspector.cfg";
			break;
		case Util.MAC:
			var fl = Components.classes["@mozilla.org/file/directory_service;1"]
					.getService(Components.interfaces.nsIProperties).get(
							"ULibDir", Components.interfaces.nsIFile);
			var fp = fl.path
					+ "/Preferences/Macromedia/Flash Player/#Security/FlashPlayerTrust/finspector.cfg";
			break;
		}
		return fp;
	},

	// Flash Player的mm.cfg文件
	getMMCfgPath : function() {
		switch (Util.OS) {
		case Util.WINDOWS:
			var fl = Components.classes["@mozilla.org/file/directory_service;1"]
					.getService(Components.interfaces.nsIProperties).get(
							"Home", Components.interfaces.nsIFile);
			var fp = fl.path + "\\mm.cfg";
			break;
		case Util.LINUX:
			var fl = Components.classes["@mozilla.org/file/directory_service;1"]
					.getService(Components.interfaces.nsIProperties).get(
							"Home", Components.interfaces.nsIFile);
			var fp = fl.path + "/mm.cfg";
			break;
		case Util.MAC:
			var fl = Components.classes["@mozilla.org/file/directory_service;1"]
					.getService(Components.interfaces.nsIProperties).get(
							"Home", Components.interfaces.nsIFile);
			var fp = fl.path + "/mm.cfg";
			break;
		}
		return fp;
	},

	// 检查Firefox是否已经安装了Debug版本的Flash Player
	isDebugFlashPlayerInstalled : function() {
		var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
		if (plugin) {
			for(var prop in plugin){
				var description = plugin.description;
			}
			return true;
		}else{
			return false;
		}
	}
};

Util.init();